package tgc.edu.library.service;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;

import tgc.edu.library.custom.CommonService;
import tgc.edu.library.entity.Book;
import tgc.edu.library.entity.BorrowRecord;
import tgc.edu.library.entity.Reader;
import tgc.edu.library.repository.BorrowRecordRepository;

@Service
public class BorrowRecordService extends CommonService<BorrowRecord, Integer>{
	@Autowired
	private BorrowRecordRepository borrowDAO;
	
	public Page<BorrowRecord> findByReader(Reader reader, Pageable pageable) {
		return borrowDAO.findByReader(reader,pageable);
	}

	public List<BorrowRecord> findByReaderAndStatus(Reader reader, String string) {
		return borrowDAO.findByReaderAndStatus(reader,string);
	}

	public BorrowRecord findByReaderAndBook(Reader reader, Book book) {
		return borrowDAO.findByReaderAndBook(reader,book);
	}

	public Page<BorrowRecord> findByReaderAndStatus(Reader user, String string, Pageable pageable) {
		return borrowDAO.findByReaderAndStatus(user,string,pageable);
	}

}
